home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / camera.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  1.0 KB  |  45 lines

  1. #ifndef _CAMERA
  2. #define _CAMERA
  3.  
  4. #include <d3dx9.h>
  5. #include "mouse.h"
  6. #include "debug.h"
  7.  
  8. class CAMERA{
  9.     friend class APPLICATION;
  10.     friend class OBJECT;
  11.     friend class PLAYER;
  12.     public:
  13.         //Init Camera
  14.         CAMERA();
  15.         void Init(IDirect3DDevice9* Dev);
  16.  
  17.         //Movement
  18.         void Scroll(D3DXVECTOR3 vec);    //Move Focus
  19.         void Pitch(float f);            //Change B-angle
  20.         void Yaw(float f);                //Change A-angle
  21.         void Zoom(float f);                //Change FOV
  22.         void ChangeRadius(float f);        //Change Radius... douh
  23.  
  24.         //Calculate Eye position etc
  25.         void Update(MOUSE &mouse, TERRAIN &terrain, float timeDelta);
  26.         void CalculateFrustum(D3DXMATRIX view, D3DXMATRIX projection);
  27.         bool Cull(BBOX bBox);
  28.         bool Cull(BSPHERE bSphere);
  29.  
  30.         //Calculate Matrices
  31.         D3DXMATRIX GetViewMatrix();
  32.         D3DXMATRIX GetProjectionMatrix();
  33.  
  34.     private:
  35.  
  36.         IDirect3DDevice9* m_pDevice;
  37.         float m_alpha, m_beta, m_radius, m_fov;
  38.         D3DXVECTOR3 m_eye, m_focus, m_right, m_look;
  39.  
  40.         //6-planes to store our view frustum
  41.         D3DXPLANE m_frustum[6];
  42. };
  43.  
  44. #endif
  45.